<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加全局参数</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>

<div class="layui-form layuimini-form" lay-filter="paramEditFormFilter">

    <div class="layui-form-item">
        <label class="layui-form-label required">参数编号</label>
        <div class="layui-input-block">
            <input type="text" name="paramId" lay-verify="required" lay-reqtext="参数编号不能为空" placeholder="请输入参数编号"
                   value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">参数键名</label>
        <div class="layui-input-block">
            <input type="text" name="paramKey" lay-verify="required" lay-reqtext="参数键名不能为空" placeholder="请输入参数键名"
                   value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">参数键值</label>
        <div class="layui-input-block">
            <input type="text" name="paramValue"  lay-verify="required"  lay-reqtext="参数键值不能为空" placeholder="请输入参数键值"
                   value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">备注</label>
        <div class="layui-input-block">
            <input type="text" name="remark"  lay-verify="required" lay-reqtext="备注不能为空" placeholder="请输入备注"
                   value=""
                   class="layui-input">
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
</div>

<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form','element'], function () {
        var form = layui.form;
        var layer = layui.layer;
        var element = layui.element;
        var $ = layui.$;


        form.on('submit(saveBtn)', function (data) {

            var data=form.val("paramEditFormFilter");

            $.ajax({

                contentType : "application/json",
                data: JSON.stringify(data),
                dataType:"json",
                type:"post",
                url: "/wfx_manager/param/addParam",
                success: function (res) {
                    if (res.flag){
                        layer.msg(res.msg,function () {
                            //获取iframe的唯一标识
                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            //关闭iframe窗口
                            parent.layer.close(iframeIndex);
                        })
                    }
                    layer.msg(res.msg);
                }
            })

            return false;
        });



    });
</script>
</body>
</html>